﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Infrastructure
{
    public class NHibernateHttpModule : IHttpModule
    {
        private static UnitOfWork uow;
        public void Dispose()
        {

        }

        public void Init(HttpApplication context)
        {
            context.BeginRequest += context_BeginRequest;
            context.EndRequest += context_EndRequest;
        }

        private static void context_BeginRequest(object sender, EventArgs e)
        {
            uow = new UnitOfWork();
        }

        private static void context_EndRequest(object sender, EventArgs e)
        {
            uow.SetComplete();
        }
    }
}
